package views
{
	import flash.display.BitmapData;
	
	import views.interfaces.IBattleFiled;
	
	import main.ViewMng;

	public class BattleView implements IView
	{
		protected var _battleField:IBattleFiled;
		
		
		public function BattleView()
		{
		}
		
		public function show():void
		{
			if( _battleField == null )
			{
				_battleField = ViewMng.instance().getUIByName( UIAsset.UI_BATTLE ) as IBattleFiled;
				
				if( _battleField == null )
				{
					return;
				}
			}
			
			ViewMng.instance().addContent( _battleField );
			
			_battleField.show();
		}
		
		public function close():void
		{
			if( _battleField )
				_battleField.close();
		}
		
		public function getUIName():String
		{
			return UIAsset.UI_BATTLE;
		}
		
		public function isInited():Boolean
		{
			return _battleField != null;
		}
		
		public function isShowed():Boolean
		{
			return _battleField && _battleField.isShowed();
		}
		
		public function draw( canvasBuffer:BitmapData ):void
		{
			this._battleField.draw( canvasBuffer );
		}
		
	}
}